import Vue from "vue";
import App from "./App.vue";
import VueCookies from "vue-cookies";
import "font-awesome/css/font-awesome.min.css";
import router from "@/router";
import {
  Button,
  Row,
  Col,
  Card,
  Form,
  FormItem,
  Input,
  DatePicker,
  Link,
  Badge,
  Divider,
  Carousel,
  CarouselItem,
  Image,
  Steps,
  Step,
  Result,
  Tabs,
  TabPane,
  Timeline,
  TimelineItem,
  Select,
  Table,
  TableColumn,
  Pagination,
  Checkbox,
  Tag,
  Option,
  InputNumber,
  Dialog,
  Message,
  MessageBox,
  Container,
  Main,
  Aside,
  Cascader,
  Descriptions,
  DescriptionsItem,
  Radio,
} from "element-ui";

Vue.prototype.$message = Message;
Vue.prototype.$confirm = MessageBox.confirm;

Vue.use(Button)
  .use(Row)
  .use(Col)
  .use(Card)
  .use(Form)
  .use(FormItem)
  .use(Input)
  .use(DatePicker)
  .use(Link)
  .use(Badge)
  .use(Divider)
  .use(Carousel)
  .use(CarouselItem)
  .use(Image)
  .use(Steps)
  .use(Step)
  .use(Result)
  .use(Tabs)
  .use(TabPane)
  .use(Timeline)
  .use(TimelineItem)
  .use(Table)
  .use(TableColumn)
  .use(Pagination)
  .use(Checkbox)
  .use(Tag)
  .use(Select)
  .use(Option)
  .use(Dialog)
  .use(InputNumber)
  .use(VueCookies)
  .use(Cascader)
  .use(Container)
  .use(Main)
  .use(Aside)
  .use(Descriptions)
  .use(DescriptionsItem)
  .use(Radio);

Vue.prototype.$message = Message;

// 处理Uncaught (in promise)报错
import Router from 'vue-router'
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}

new Vue({
  router,
  render: (h) => h(App),
}).$mount("#app");
